﻿#ifndef JZSELFLAYOUT_H
#define JZSELFLAYOUT_H

#include <QObject>
#include <QWidget>
#include <QResizeEvent>

class JZSelfLayout : public QObject 
{
    Q_OBJECT

public:
    explicit JZSelfLayout(QObject *parent = nullptr);
    void setWidget(QWidget *widget);
    void setAlignment(Qt::Alignment alignment);
    void setOffset(int xOffset, int yOffset);       

private:
    virtual bool eventFilter(QObject *watched, QEvent *event);
    void handleParentResize();

    QWidget *m_widget;
    Qt::Alignment m_alignment;
    int m_xOffset;
    int m_yOffset;
};

#endif // JZSELFLAYOUT_H    